
class Animal {
    String name;
    int age;
    String color;

    public Animal(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public void eat() {
        System.out.println(this.name+"正在吃...");
    }

    public void sleep() {
        System.out.println(this.name+"正在睡...");
    }
}


class Dog extends Animal {
    public Dog(String name, int age) {
        super(name, age);
    }

    public void bark() {
        System.out.println(this.name + "正在汪汪叫...");
    }

}

class Cat extends Animal {
    public Cat(String name, int age) {
        super(name, age);
    }

    public void Miao() {
        System.out.println(this.name + "正在喵喵叫...");
    }
}

public class Inheritance {
    public static void main(String[] args) {
        Dog dog1=new Dog("小狗",2);
        System.out.println(dog1.name+" "+dog1.age+" "+dog1.color);
        Cat cat1=new Cat("小猫",1);
        System.out.println(cat1.name+" "+cat1.age+" "+cat1.color);
    }
}
